package org.javagril.yuetong.controller.driver;

import org.javagril.yuetong.bean.RespPageBean;
import org.javagril.yuetong.service.DriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author QingtungTree
 * @Datetime: 2019/12/28
 * @Description:org.javagril.yuetong.controller.driver
 * @Version:
 */

/*使用@RestController注解Controller，
则Controller中的方法无法返回jsp页面，
配置的视图解析器InternalResourceViewResolver不起作用，
返回的内容就是Return 里的内容。*/
@RestController
@RequestMapping("/driver")
public class DriverController {

    @Autowired
    DriverService driverService;
    /*查询 驾驶员信息*/
    @GetMapping("/")
    public RespPageBean getAllDrivers(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size){
        return driverService.getAllDrivers(page,size);
    }

}
